Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish
|
NetLogo User Community Models(back to the NetLogo User Community Models)
# BULLS & BEARS - A MINIMALIST ARTIFICIAL STOCK MARKET
The model explores the mechanism of price formation in a stock market. The model is relatively simple, yet generates all the emergent properties of real stock markets. It also shows under what circumstances one can get pathological price behaviour such as monotonic moves to zero or infinity, or permanent oscillations between two price levels.
## THE MODEL
There is one asset (a stock) in the market. The model is non-spatial. Agents (investors) do not interact with each other directly but with the stock price, which is determined by the total demand for the stock, i.e., they interact indirectly in their aggregate. So net aggregate demand determines the price movement in each time period (tick), and this price movement then determines the investors' demand in the next time period. The price formation mechanism is thus highly recursive.
### Investor types
There is a variable number of investors. These investors are of two types, followers and contrarians, with two diametrically opposite strategies. If the stock’s price moved up in the last time period, followers want to buy while contrarians wish to sell, and vice versa for a downward move in price. There are therefore always buyers and sellers, but with differing demands of the quantity desired to transact. There is no leverage, but short selling is allowed.
Sales of the stock generate cash for an investor and purchases require cash. An investor's wealth is the sum of the value of their shareholding and their cash balance.
### Demand function
For each investor, their demand function contains three components:
**Risk demand.**
The value of the risk demand is the same for all investors in one time period. Individual investors are then randomly assigned an individual risk demand in the range [0, risk demand].
**Herd demand.**
So herd demand = (_k_<sub>2</sub>) (total demand of followers) for followers, and
This value of herd demand is therefore different for each type of investor in a time period. Individual investors of each type, i.e. followers and contrarians, are then randomly assigned an individual herd demand in the range [0, herd demand - followers] and [0, herd demand - contrarians] respectively.
**Wealth demand.**
This demand component is the same for all investors. Note "wealth demand" will be of the same sign as wealth, which we assume can be negative as well as positive. This value of wealth demand is the same for all investors in one time period. Individual investors are then randomly assigned an individual wealth demand in the range [0, wealth demand].
Investors' wealth is dependent on how many shares they buy or sell in each time period. The value of their shares will then change with the new share price in the next period, in turn changing their wealth.
The total demand for each investor is then the sum of these three demands. Its sign must always be positive as it is the "size of desired bet", and its sign will simply be determined by the direction of the previous price move. Therefore, if the magnitude of total demand is less than zero, it is set to zero.
### Price, price return, value and volume traded
The change in stock price is then proportional to this net demand. So, at time _t_ the price is
Note that changing the number of investors is not neutral - a larger number of investors will tend to result in larger net demands _D_, which will cause larger price changes.
The stock price return will be
Followers and contrarians will usually wish to transact with different amounts of demand, so to clear the market the total share value traded is
Note that all the model's relationships are linear, while in the real world everything is non-linear!
## HOW TO USE IT
The input items in the interface tab are largely self-explanatory, consisting of the number of investors, the fraction of investors who are contrarians, the persistence of investors' memory (_m_ time periods) and the empirical parameters _k_<sub>1</sub>..._k_<sub>5</sub>.
## OUTPUTS
The prime output is the share price graph. The value of stock demanded (in dollars) by followers and contrarians, and their total, is also shown. The next plot shows the percentage return in each period, together with the moving average of the previous _m_ periods, i.e. it shows if the share has generally gone up or down in investors' recent memory, and by how much. The distribution of these returns is also shown. Market returns are not random and their distribution is not normal. The volatility of price movements over the past 36 periods is calculated and displayed. Trade, in both dollars and number of shares, is also plotted, as is the dollar wealth of followers, contrarians and their total. The Demand/Wealth graph is discussed in NETLOGO FEATURES.
This data can then be extracted with BehaviorSpace and analysed to see if it accords with the known emergent phenomena of markets, which include:
* persistence of returns
## THINGS TO NOTICE
A market consisting of only these two types of investors is intrinsically unstable. This is exacerbated by the fact that as an investor's wealth grows, they take larger buying or selling positions.
There are two bounding unstable price behaviors:
Most combinations of parameter settings eventually lead to these bounding behaviors.
Also, in the case of monotonic increases or decreases in price, the wealth of followers will become infinite, while price oscillations will see the wealth of contrarians rise to infinity, as these investors will make the correct decision in every time period.
These behaviors are legitimate and would happen in a real market as modeled. They are not a code flaw. They demonstrate the intrinsic instability of markets. Market crashes, for example, often occur without any obvious proximate cause - they are simply emergent behavior. (And, inevitably, if the price goes to zero, many variables tend to blow up.)
## THINGS TO TRY
Best explored with the _"go once"_ or _"go slowly"_ buttons. Try adjusting the parameters under various settings. How sensitive is the stability of price behavior to these parameters? Which parameters counteract each other and which reinforce each other? If there are exactly equal numbers of followers and contrarians, what does the stock price do? See the extreme situations where there are only followers or contrarians, which breaks the market. Do the returns look random or is there clustering? Can you see fat tails and kurtosis in the return distributions? Does the price volatility correlate with anything?
## EXTENDING THE MODEL
Possible embellishments of the model are limitless. Additional investor categories such as long-term and short-term players and insider traders could be added. Individual investors could be allowed to use leverage. Also, risk appetite (as determined by the moving average) has been the same for each investor type. Ideally, each investor should use the moving average of their individual return history. Additional assets, as well as transaction costs could be incorporated. Most importantly, investors could be given a range of different and possibly competing strategies, including adaptive ones - which is closest to the actual behaviour in real markets. (This was the original Santa Fe Artificial Stock Market Model.)
## NETLOGO FEATURES
Because the model is non-spatial, the main plot has been transformed into a graph. This graph shows 5 dimensions for each agent on the same plot using shape, coordinates, size and color intensity to indicate agent type, wealth, demand, herd influence and risk aversion, respectively.
The histogram is of a global variable, not a turtle property. In this case, 'histogram' operates on a list. So the variable's values were accumulated in a list, with the list being extended by one element at each tick. Lists were also required to accumulate histories for the moving average of the last _m_ returns and 36-period price volatility.
They were also used for the dynamic scaling of some graphs. Smart scaling is implemented on the 'Returns distribution', 'Price volatility' and 'Trade' graphs via plot update commands.
A zero axis is drawn on the Demand and Period return & MA graphs. The Price volatility graph only begins drawing after 36 periods, using the plot-pen-up command in the plot update commands.
## RELATED MODELS
The seminal model in this genre was the original Santa Fe Artificial Stock Market Model:
A later retrospection on it was:
Various improvements were suggested in the book:
There has been surprisingly little highly-cited research since then. Two studies are:
## HOW TO CITE
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
## COPYRIGHT AND LICENSE
![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. |
(back to the NetLogo User Community Models)